﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ext.Master" AutoEventWireup="true" CodeBehind="Helloworld.aspx.cs" Inherits="Demo.Helloworld" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        Ext.onReady(function () {
            var btn = new Ext.Button({
                renderTo: 'btn',
                text: '创建新的按钮',
                handler: function () {
                    Ext.onReady(function () {
                        Ext.create('Ext.Button', {
                            renderTo: Ext.getBody(),
                            text: 'New Button',
                            handler: function () {
                                Ext.MessageBox.alert('Info', 'I am new button!');
                            }
                        });
                        Ext.MessageBox.alert('Hello', 'Hello World!');
                        
                    });
                }
            });
        });

        function btnOKClick() {
            alert("btnOK Clicked");
            setTimeout(function () {
                $('#btnOK').attr('onclick', '').bind('click', function () { reclick(); });
            }, 1);
        }

        function reclick() {
            alert('reclick');
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="btn"></div>
    <div id="Div1"></div>
    <input type="button" id="btnOK" name="" value="确定" onclick="btnOKClick();" />
    <input type="button" value="创建按钮" id="btnCreateButton" />
    <div id="newBtn"></div>
    <script type="text/javascript">
        $(function () {
            $('#btnCreateButton').bind('click', function () {
                //alert('click');
                Ext.create('Ext.Button', {
                    text: '新按钮',
                    handler: function () {
                        Ext.MessageBox.alert('info', 'new button');
                    },
                    renderTo: 'newBtn'
                });
            });
        });
        
    </script>
</asp:Content>
